﻿using System.Collections.Generic;
using System.Linq;

namespace dPet.Web.Admin.ViewModels
{
	using dPet.Application.DataObjects;
	using Hangerd.Mvc.Authentication;

	public class AdministratorModel
	{
		static readonly List<AdministratorDto> _adminUsers = new List<AdministratorDto>
		{
			new AdministratorDto { LoginName = "admin", Password = "111111" }
		};

		public static bool Validate(string loginName, string password)
		{
			if (_adminUsers.Where(a => a.LoginName == loginName && a.Password == password).Count() > 0)
			{
				return true;
			}

			return false;
		}

		public static AdministratorDto Current
		{
			get
			{
				if (LoginHelper.IsLogin())
				{
					return _adminUsers.FirstOrDefault(a => a.LoginName == LoginHelper.GetUserId());
				}

				return null;
			}
		}
	}
}
